require('./Models/Log');

var fs = require('fs');
require('buffer');

var util = require('util');

var Logger = module.exports = function() {
	this.level = 0;
	
	// Open log file
	this.fLog = {};
	fs.open('./Logs/main.log', 'a+', function(e, fd) {
		if(e) {
			util.log("----- Logger.js\n " + e.message + "\n ----- Stack Trace-----\n " + e.stack);
		} else {
			this.logFile = fd;
		}
	});
	
};

Logger.prototype.carp = function(e) {
	if(typeof(e) == 'object') {
		var error = new Buffer(e);
	}
};

Logger.prototype.croak = function(e) {
	if(typeof(e) == 'object') {
		util.log(e.type + ": " + e.message + "\n ----- Stack Trace-----\n " + e.stack);
	} else if(typeof(e) == 'string') {
		util.log(e);
	}
	
	process.exit(0);
};
